2026-02-02
...
$EST METHOD=1 INTERACTION POSTHOC NOABORT PRINT=1
MAXEVAL=9999 SIGL=9 NSIG=3 MSFO=./001b.MSF
$COV UNCOND MATRIX=S PRINT=E
...
...
$CHAIN FILE=../001b/001b.ext NSAMPLE=0 ISAMPLE=-1000000000
$RCOV FILE=../001b/001b.cov
$ETAS FILE=../001b/001b.phi
$EST METHOD=1 INTERACTION POSTHOC NOABORT PRINT=1
MAXEVAL=9999 SIGL=9 NSIG=3 FNLETA=2
$COV PRINT=E SIRSAMPLE=5000 FILE=./001b-sir.ext
...
Reference: NONMEM 7.5.0 userguide
$CHAIN)$CHAIN FILE=../001b/001b.ext NSAMPLE=0 ISAMPLE=-1000000000
FILE specify the .ext file importedNSAMPLE=0 no samplingISAMPLE=-1000000000 takes the ITERATION=-1000000000 record in FILE$RCOV/$RCOVI and $ETAS/$PHI)$RCOV FILE=../001b/001b.cov
$ETAS FILE=../001b/001b.phi
$RCOV provides covariance matrix (.cov file, either from $COV step or somewhere else)$RCOVI can be used instead of $RCOV with the input being the .coi file$RCOV/$RCOVI only implementable since NONMEM 7.5.0$ETAS($PHIS) provides \(\mathit{ETA_{i}}\)$EST)$EST METHOD=1 INTERACTION POSTHOC NOABORT PRINT=1
MAXEVAL=9999 SIGL=9 NSIG=3 FNLETA=2
FNLETA=2 suppresses the execution of $EST, allows the use of imported estimates from $CHAIN, $RCOV and $ETAS$COV)$COV PRINT=E SIRSAMPLE=5000 FILE=./001b-sir.ext
SIRSAMPLE=5000 specify the number of SIR samplingFILE specify the name output. If not specified, by default, it will append the SIR output to the model_name.ext as a second table
ITERATION THETA1 THETA2 … OMEGA.6.6. OBJ WEIGHT 0 -4.89991 0.838115 … 0 42724.25 1.000000e+00 1 -4.94797 0.823778 … 0 42739.10 1.252805e+00 2 -4.88234 0.873831 … 0 42728.04 1.245718e+00 . . . … . . . . . . … . . . . . . … . . . 5000 -4.90715 0.744407 … 0 42747.94 3.727524e+00 -1000000000 -4.89505 0.837854 … 0 42732.60 1.239093e+00 . . . … . . .
sirsample0 <- read.table(file.path(modelDir, sirrunno, "001b-sir.ext")),
skip = 1, header = TRUE)
sirsample1 <- sirsample0 %>% filter(ITERATION > 0)
# compute resample probability based on importance ratios (WEIGHT)
sirsample1 <- sirsample1 %>% mutate(prob = WEIGHT/sum(WEIGHT, na.rm = TRUE))
# resample
M1 <- 1000
withr::with_seed(seed = 0720,
sample_rows <- sample(x = sirsample1$ITERATION,
size = M1,
replace = TRUE,
prob = sirsample1$prob))
sirresample1 <- sirsample1[sample_rows, ]WEIGHTM2 <- 1000
# `table_resample root.ext root_new.ext delimiter newsize SEED start end`
system(glue('/opt/NONMEM/nm75/util/table_resample
./model/pk/001b-sir/001b-sir.ext
./model/pk/001b-sir/001b-sir-rs.ext
s {M2} 0720'))
sirresample2 <- read.table("./model/pk/001b-sir/001b-sir-rs.ext",
skip = 1, header = TRUE) %>%
filter(ITERATION > 0)SEED: sample with replacementSEED: sample without replacementSEED = 0: expand samples, based on WEIGHT columnSIRDF in $COV$COV PRINT=E SIRSAMPLE=5000 FILE=./001b-sir.ext.
$COV PRINT=E SIRSAMPLE=5000 SIRDF=4 FILE=./001b-sir.ext
SIRDF: The proposal density is to be a t distribution with n degrees of freedom. Default is 0, a normal density. You may wish to utilize a t-distribution with SIRDF degrees of freedom, to provide heavy tail samplingIACCEPT in $COV$COV PRINT=E SIRSAMPLE=5000 FILE=./001b-sir.ext.
$COV PRINT=E SIRSAMPLE=5000 IACCEPT=0.4 FILE=./001b-sir.ext
IACCEPT: With IACCEPT=0.4, for example, the proposal density variance is made to be greater than the original variance-covariance, and more sampling is done farther away from the center.SIRSAMPLE) to increase sampling to resampling ratio$COV PRINT=E SIRSAMPLE=2500 FILE=./001b-sir.ext
$COV PRINT=E SIRSAMPLE=5000 FILE=./001b-sir.ext
$COV derived distribution.$CHAIN, $ROV, $ETAS to import final model output.$EST suppressing with FNLETA=2$COV to perform SIR samplingSIRDF: smaller SIRDF increase proposal distribution DF moreIACCEPT: smaller IACCEPT increase proposal distribution DF moreSIRSAMPLESIRDF, IACCEPT, SIRSAMPLE (sampling to resampling ratio) as needed.$COV derived confidence intervals and visualize the spatial trend plots can be useful to check, parameter by parameter, whether the proposal distribution differs from the true uncertainty.